<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>ICE HOCKEY MANAGER - Offers</title>
            <link rel="stylesheet" href="graphics/style.css" media="screen" />
        </head>
        <body>

            <div id="head">
                <h1><h:outputText value="Ice Hockey Manager"/></h1>
            </div>

            <h:form>
                <div id="top-panel">
                    <h:outputText value="#{msgs.logged_in_as}: #{manager.loginName} " />
                    <h:outputText value="(#{msgs.chosen_club}: #{manager.currentClub.name}) " rendered="#{manager.hasClub}" />
                    <h:commandButton value="#{msgs.logout}" action="#{manager.logout}" />
                </div>

                <ul id="menu">
                    <li>
                        <h:commandLink action="#{manager.editTeam}" value="#{msgs.my_team}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.browseOtherTeams}" value="#{msgs.other_teams}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editOffers}" value="#{msgs.offers}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editClub}" value="#{msgs.edit}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editPassword}" value="#{msgs.change_pass}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.clubsList}" value="#{msgs.clubsList}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.createClub}" value="#{msgs.createNewClub}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.createLeague}" value="#{msgs.createNewLeague}" rendered="#{manager.isAdmin}" />
                    </li>
                </ul>

            </h:form>

            <div id="content">
                <div id="in">

                    <h:form rendered="#{manager.hasClub}">

                        <h2><h:outputText value="#{manager.currentClub.name} - #{msgs.offers}"/></h2>
                        <h3><h:outputText value="#{msgs.my_offers}"/></h3>
                        <h:dataTable value="#{manager.myOffersModel}" var="item" rowClasses="OddRow,EvenRow" columnClasses="post,playerName,skill,skill,skill,skill,skill,skill,skill,clubName,money,action">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.pos}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.positionInCurrentTeam}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.player_name}"/>
                                </f:facet>
                                <h:graphicImage value="graphics/cze.png" width="20" height="14" alt="CZE" rendered="#{item.player.nationality == 'CZE'}"/>
                                <h:graphicImage value="graphics/svk.gif" width="20" height="13" alt="SVK" rendered="#{item.player.nationality == 'SVK'}"/>
                                <h:outputText value="#{item.player.firstName} #{item.player.surname}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.age}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.age}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.pst}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.post}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.goa}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.goalkeeping}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.tec}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.technique}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.str}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.strength}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.spe}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.speed}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.sho}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.shot}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.employer}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.club.name}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.money}"/>
                                </f:facet>
                                <h:outputText value="#{item.money} Kč"/>
                            </h:column>
                            <h:column>
                                <h:commandButton action="#{manager.cancelOffer}" value="#{msgs.cancel}" />
                            </h:column>
                        </h:dataTable>

                        <h:messages />

                        <h3><h:outputText value="#{msgs.offers_for_my_players}"/></h3>
                        <h:dataTable value="#{manager.offersForMyPlayersModel}" var="item" rowClasses="OddRow,EvenRow" columnClasses="post,playerName,skill,skill,skill,skill,skill,skill,skill,clubName,money,action,action">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.pos}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.positionInCurrentTeam}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.player_name}"/>
                                </f:facet>
                                <h:graphicImage value="graphics/cze.png" width="20" height="14" alt="CZE" rendered="#{item.player.nationality == 'CZE'}"/>
                                <h:graphicImage value="graphics/svk.gif" width="20" height="13" alt="SVK" rendered="#{item.player.nationality == 'SVK'}"/>
                                <h:outputText value="#{item.player.firstName} #{item.player.surname}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.age}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.age}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.pst}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.post}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.goa}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.goalkeeping}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.tec}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.technique}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.str}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.strength}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.spe}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.speed}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.sho}"/>
                                </f:facet>
                                <h:outputText value="#{item.player.shot}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.interestedClub}"/>
                                </f:facet>
                                <h:outputText value="#{item.club.name}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{msgs.money}"/>
                                </f:facet>
                                <h:outputText value="#{item.money} Kč"/>
                            </h:column>
                            <h:column>
                                <h:commandButton action="#{manager.acceptOffer}" value="#{msgs.accept}" />
                            </h:column>
                            <h:column>
                                <h:commandButton action="#{manager.denyOffer}" value="#{msgs.deny}" />
                            </h:column>
                        </h:dataTable>
                </h:form>

                <h:form rendered="#{not manager.hasClub}">
                    <h:outputText value="#{msgs.createYourClub} "/>
                    <h:commandLink action="#{manager.createClub}" value="#{msgs.here}" />
                </h:form>

            </div>
        </div>

        <div class="clr" />
    </body>
</html>
</f:view>

